package cn.vconinfo.app.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalException {

    @ExceptionHandler(Exception.class)
    public ResponseEntity<String> handleException(Exception ex){
        log.error("系统异常", ex);
        ResponseEntity<String> response = new ResponseEntity<>("系统异常请联系管理员", HttpStatus.BAD_REQUEST);
        return response;
    }

}
